{extend name='admin@main'}

{block name="content"}


<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">

    <div class="layui-card-body think-box-shadow padding-left-40">

        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs1 relative">
                <span class="color-green">显示/隐藏</span>
                <select class="layui-select" name="show" required>
                    {foreach ['0'=>'隐藏','1'=>'显示'] as $k=>$v}
                    <!--{eq name='$vo.show' value='$k.""'}-->
                    <option selected value="{$k}">{$v}</option>
                    <!--{else}-->
                    <option value="{$k}">{$v}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </label>
            <label class="layui-col-xs1 relative">
                <span class="color-green">兑换积分</span>
                <input name="point" required class="layui-input" placeholder="请输入兑换积分" value="{$vo.point|default=''}">
            </label>
        </div>
        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs2 relative">
                <span class="color-green">商品名称</span>
                <input name="title_zh_cn"  class="layui-input" placeholder="请输入商品名称" value="{$vo.title_zh_cn|default=''}">
            </label>
        </div>
        <div class="layui-form-item">
            <span class="color-green">商品封面图片（尺寸： 1000*750）</span>
            <table class="layui-table">
                <thead>
                <tr>
                    <th class="text-center">商品封面图片</th>
                </tr>
                <tr>
                    <td width="90px" class="text-center"><input name="img" type="hidden" value="{$vo.img|default=''}"></td>
                </tr>
                </thead>
            </table>
            <script>$('[name="img"]').uploadOneImage()</script>
        </div>
        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs6 relative">
                <span class="color-green">商品详情</span>
                <textarea name="content_zh_cn">{$vo.content_zh_cn|default=''|raw}</textarea>
            </label>
        </div>
        <div class="layui-form-item text-center">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn" type="submit">保存</button>
        </div>

    </div>
</form>
{/block}

{block name='script'}
<script>
    window.form.render();
    require(['ckeditor', 'angular'], function () {
        window.createEditor('[name="content_zh_cn"]', {height: 300});
        var app = angular.module("GoodsForm", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);

        function callback($rootScope) {
            $rootScope.hsitoryBack = function () {
                $.msg.confirm('确定要取消编辑吗？', function (index) {
                    history.back(), $.msg.close(index);
                });
            };
        }

    })
</script>
{/block}
